// 类似普通项目中CRUD的接口实现
package main

import (
	"fmt"
)

type User2 struct {
	id   int
	name string
}

type UserServiceImpl struct {
}

type IUserSerive interface {
	Save(u User2)
	Get(id int) User2
}

func (s UserServiceImpl) Save(u User2) {
	fmt.Println("save user. id", u.id, " name:", u.name)
}

func (s UserServiceImpl) Get(id int) User2 {
	return User2{id: id, name: "xxx"}
}

func main() {
	var user User2 = User2{id: 100, name: "zxy"}
	var service IUserSerive = new(UserServiceImpl)
	service.Save(user)
	userGet := service.Get(123)
	fmt.Println("userGet:", userGet)
}
